<script setup lang="ts">
import type { BMaskProps } from './type.d'
// ------------------use------------------
// #region
withDefaults(defineProps<BMaskProps>(), {
  show: false,
  content: '内容。。。。',
  type: 'primary',
})
// #endregion
// ------------------静态变量------------------
// #region

// #endregion
// ------------------动态变量------------------
// #region

// #endregion
// ------------------ref-----------
// #region

// #endregion
// ------------------reactive------
// #region

// #endregion
// ------------------computed------
// #region

// #endregion
// ------------------生命周期------------------
// #region

// #endregion
// ------------------内置方法---------------------
// #region

// #endregion
// ------------------方法---------------------
// #region

// #endregion
</script>

<template>
  <div
    class="b-mask"
    :class="[
      `b-mask--${type}`,
      {
        'b-mask__show': show,
      },
    ]"
    :content="content"
  >
    <slot />
  </div>
</template>

<style lang="scss" scoped>
$MenuType: (
  danger,
  success,
  warning,
  info,
  primary,
  danger
);
@each $type in $MenuType {
  [class].b-mask--#{$type} {
    --b-mask-color: var(--el-color-#{$type});
    --b-mask-color-rgb: var(--el-color-#{$type}-rgb);
  }
}
//------------------组件样式------------------
.b-mask {
  --b-mask-color: var(--el-color-primary);
  --b-mask-color-rgb: var(--el-color-primary-rgb);
  position: relative;
  &::after {
    opacity: 0;
    pointer-events: none;
    display: grid;
    place-content: center;
    position: absolute;
    inset: 0px;
    content: attr(content);
    font-weight: bold;
    font-size: 20px;
    color: var(--b-mask-color);
    text-shadow: 0px 0px 5px
        rgba(var(--b-mask-color-rgb), 0.1),
      0px 0px 10px rgba(var(--b-mask-color-rgb), 0.2),
      0px 0px 15px rgba(var(--b-mask-color-rgb), 0.3);
    z-index: 9;
    background-color: rgba(var(--b-mask-color-rgb), 0.2);

    border-radius: 6px;
    border: 2px solid currentColor;
    width: 100%;
    height: 100%;
    transition: opacity 0.3s, backdrop-filter 0.3s,
      box-shadow 0.3s, width 0.3s, height 0.3s;
  }
  &__show::after {
    opacity: 1;
    pointer-events: all;
    backdrop-filter: blur(4px);
    cursor: pointer;
  }
  &__show:hover::after {
    backdrop-filter: blur(2px);
    box-shadow: 0px 0px 4px inset currentColor,
      0px 0px 10px inset var(--el-bg-color);
  }
}
//-------------样式穿透-------------
</style>
